<include file="__THEME__/header" />
<link href="../Public/css/space.css" rel="stylesheet" type="text/css" />
<link href="../Public/css/colleague.css" rel="stylesheet" type="text/css" />
<div class="contents lbg B">
<include file="../Public/home_left" />
  <div class="contents_min w787">
    <div class="write_info">
	<div class="mb10">
        <h3 class="tit_h3">{:L('my_contact')}</h3>
      </div>
        <div class="list_cate_nav">
      <div class="tab">
        <!-- 切换标签 begin  -->
        <ul>
          <li><span><a href="__URL__&act=index">{:L('nav_index')}</a></span></li>
          <li><span><a href="__URL__&act=add">{:L('nav_add')}</a></span></li>
          <li class="on"><span><a href="__URL__&act=search">{:L('nav_search')}</a></span></li>
          <li><span><a href="__URL__&act=track">{:L('nav_track')}</a></span></li>
          <li><span><a href="__URL__&act=followYou">{:L('nav_followyou')}</a></span></li>
          <li><span><a href="__URL__&act=followMe">{:L('nav_followme')}</a></span></li>				  
        </ul>
      </div>
      <form action="" method="post" >
      <div class="FList" style="width:800px;">
      <h2>{:L('search_col')}</h2>
      	<ul class="mt10">
        <li class="LW">
        	{:L('uname')}: <input class="in_put" name="username" type="text" style="width:200px;"/>
            </li>
            <li class="LW">
            {:L('col_num')}: <input class="in_put" name="uname" type="text" style="width:200px;"/>
            </li>
            <li class="lf"><input name="" type="submit" value="{:L('search_col')}"  class="btn_sea"/></li>
        </ul>
      </div>
      	</form>
      <div class="C"></div>
<php>if($_POST){</php>
      <div class="tab_b" style="margin-top:20px"><span class="f12 fB">{:L('search_res')}</span></div>
      <php>if($list){</php>
        <div class="FList W"><!-- 我的好友 begin  -->
                <ul style="padding: 0px;margin: 10px auto 0px auto;">
				 <volist id="vo" name="list">
				 <li class="li pb10 pt5" id="fri_10001" >
                            <div class="L" style="width:70px;"><span class="headpic50">
                                    <a href="{:U('space/View/index','uid='.$vo['uid'])}"><img src="{$vo.uid|getUserFace}" /></a></span></div>
                      <div class="L" style="width: 600px; margin-right: 20px;">
                                <p class="lh20"><a href="{:U('space/View/index','uid='.$vo['uid'])}">{$vo.fullname}</a></p>
                                <p class="cl06 lh20">{$vo['record']['content']}</p>
                      </div>
						<div class="L" style="width:90px;">
	                        <p class="lh20"><a href="{:U('space/View/index','uid='.$vo['uid'])}">{:L('view_space')}</a></p>
	                        <p class="lh20"><a href="{:U('home/Message/index',array('type'=>'send','touid'=>$vo['uid']))}" target="_blank">{:L('send_msg')}</a></p>
							<php>if(!isMyColleague($vo['uid'])){</php>
	                        	<p class="lh20" id="list_{$vo.uid}"><a href="javascript:void(0)" onclick="addToColleague({$vo.uid},'{$vo.uid|getUserName}')">{:L('add_to_contact')}</a></p>
							<php>}</php>
	                    </div>
                            <div class="C"></div>
                        </li>
					</volist>
                    </ul>
            </div>		
		<php>}else{</php>
			<div class="FList W">{:L('no_match_col')}</div>
		<php>}</php>

<php>}</php>
</div>	
    </div>	
	</div>
    <div class="C"></div>
    </div>
<script>
	function addToColleague(uid,uname){
		var html = '<div style="width:350px"><ul style="margin:5px">'
			     + '<li>'+'{:L("group")}'+': <select id="doAddgid"  style="border: 1px solid rgb(204, 204, 204);">'
				 <volist id="vo" name="grouplist">
			     + '<option value="{$key}">{$vo}</option>'
			     </volist>
			     + '</select>'
			     + '<li>'+'{:L("remark")}'+': <textarea id="doAddremark" style="border: 1px solid rgb(204, 204, 204); width: 300px; height: 120px;"></textarea>'
			     + '</ul></div>'
			     + '<div style="display: block;" id="tb_content_list" class="tb_button_list">'
			     + '<p><input type="button" value="{:L("ok")}" name="" onclick="doAddColleague('+uid+')" id="tb_button_ok" class="mr10"/><input type="button" value="{:L("cancel")}" id="tb_button_no" onclick="$.tbox.close()" name="" class="mr10"/>'
			     + '</p></div>';
		$.tbox.popBox(html,"{:L('add_to_contact')}");
	}
	
	function doAddColleague(uid){
		var gid = $('#doAddgid').val();
		var remark = $('#doAddremark').val();
		$.post("{:U('home/Colleague/doaddone')}",{fid:uid,gid:gid,remark:remark},function(txt){
			if(txt=='1'){
				$.tbox.close();
				$("#list_"+uid).html('<font color="red">{:L("success_add")}</font>');
			}else if(txt=='0'){
				alert('{:L("no_group_selected")}');
			}else if(txt=='-2'){
				alert('{:L("is_col")}');
			}else{
				alert('{:L("fail_add")}');
			}
		});
	}
</script>

  <div class="C"></div>
  </div>
<include file="__THEME__/footer" /> 